package com.zxl.designpattern.structure.adapter;

/**
 * @author zxl
 * @version 1.0
 * @description 适配器测试类
 * @date 2025/6/1 16:45
 */
public class Test {

    public static void main(String[] args) {
        testClassAdapter();
        testObjectAdapter();
        testInterfaceAdapter();
    }

    /**
     * 测试类适配器
     */
    public static void testClassAdapter() {
        PaymentAdapter adapter = new PaymentAdapter();
        adapter.processPayment(100, 1);
        adapter.processPayment(100.56, 2);
    }

    /**
     * 测试对象适配器
     */
    public static void testObjectAdapter() {
        PaymentObjectAdapter adapter = new PaymentObjectAdapter(new LegacyPaymentSystem());
        adapter.processPayment(200, 1);
        adapter.processPayment(200.78, 3);
    }

    /**
     * 测试接口适配器
     */
    public static void testInterfaceAdapter() {
        Payment payment = new Alipay();
        payment.processAlipay(300);
    }
}
